package core

import (
	"faker/project-public/global"
	"fmt"
	"github.com/spf13/viper"
)

func Viper() *viper.Viper {
	v := viper.New()
	v.SetConfigFile("config/config.yaml")
	v.SetConfigType("yaml")
	err := v.ReadInConfig()
	if err != nil {
		panic(fmt.Errorf("Fatal error config file: %s \n", err))
	}
	v.WatchConfig()
	if err = v.Unmarshal(&global.FAKER_CONFIG); err != nil {
		fmt.Println(err)
	}
	return v

}
